function request(url, method = 'GET', data = {}, token) {
	return new Promise((resolve, reject) => {

		// let token = uni.getStorageSync('token');
		var token = localStorage.getItem("token");
		
		
		let header={}
		// console.log('headertoken',token)
		if(token){
			header['Authorization']='Bearer '+token;
		}
		uni.request({
			url: url,
			method: method,
			data: data,
			header: header,
			success: (res) => {
				// console.log(res, 'rrrrrrr')
				if (res.data.error_code == 0) {
					resolve(res.data);
				} else if (res.data.error_code == 401) {
					uni.showToast({
						title: "token过期",
						icon: "none",
					})
					setTimeout(()=>{
						uni.navigateTo({
							url:"/jingqu/login/login"
						})
					},800)
				}else{
					resolve(res.data);
				}

			},
			fail: (err) => {
				reject(err);
			}
		});
	});
}
export default request